<?php

class MotherController extends Zend_Controller_Action {

    public function init() {
        /* Initialize action controller here */
    }

    public function indexAction() {
        // action body
    }

    public function postDispatch() {
        $this->view->MVC = $this->_getMVC();
    }

    private function _getMVC() {
        $mvc = array();
        $mvc['module'] = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
        $mvc['controller'] = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
        $mvc['action'] = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
        return $mvc;
    }

    public function _categorie($param=NULL) {

        if('invoice' == $param)
            return array('Factures' => array('/Invoice/Index/create'=>'Créer','/Invoice/Index/index' => 'Gestions des factures'));
        
        return array('utilisateur' => array('/Admin/user' => 'Gestions des utilisateurs'), 'Factures' => array('/Admin/invoice' => 'Gestions des factures'));
    }

    public function checkAdmin(){
        if (!isset($_SESSION['SecureLogin'])) {
            $this->_redirect('/Admin/index/login');
        }
        elseif("admin" != $_SESSION['SecureLogin']['role'])
            $this->_redirect('/Admin/index/erreur');
    }

}

